package com.example.makerspace.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.makerspace.domain.OrganizeDO;
import com.example.makerspace.domain.OrganizeProjectDO;
import com.example.makerspace.mapper.OrganizeMapper;
import com.example.makerspace.mapper.OrganizeProjectMapper;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@Component
public class OrganizeProjectDAO extends  BaseDAO<OrganizeProjectDO>{
    @Resource
    private OrganizeProjectMapper organizeProjectMapper;
    @PostConstruct
    public void init(){
        this.mapper = organizeProjectMapper;
    }

    public List<OrganizeProjectDO> selectByUserName(String username) {
        QueryWrapper<OrganizeProjectDO> wrapper = new QueryWrapper<>();
        wrapper.eq("username",username);
        return mapper.selectList(wrapper);
    }

    public List<OrganizeProjectDO>  selectByOrganizeId(Integer organizeId) {
        QueryWrapper<OrganizeProjectDO> wrapper = new QueryWrapper<>();
        wrapper.eq("organize_id",organizeId);
        return mapper.selectList(wrapper);
    }
}
